<?php
include('header.php');
//invalid URL, redirect to index page
if (!$session->isAdmin())
{
	header("Location: ../index.php");
} 
else 
{
	if (!isset($_GET['id'])) 
	{ 
		//header("Location: ".$config['WEB_ROOT'].$config['home_page']);
		header("Location: main.php?id=4");
	}
	else if (isset($_GET['id']) && is_numeric($_GET['id']) && $_GET['id'] > 0)
	{
		$orgID = $_GET['id'];
		$req_org_info = $database->getOrgInfo($orgID); ?>
<div id="form_container">
    <div id="title_container">
        <div id="title">
            <p><?php echo $req_org_info['orgName'] ?></p>
        </div>
        <div id="title_link">
            <p><a href='editOrg.php?id=<?php echo $orgID; ?>'>Edit Organization</a></p>
        </div>
    </div>
    <div id="form_content">
    <ul>
    <form>
    	<fieldset><legend>Organization Information</legend>
    	<li id="li_orgName">
            <label id="label_orgName">Organization Name</label>
            <input id="orgName" name="orgName" type="text" disabled="disabled" size="30" maxlength="30"  value="<?php echo $req_org_info['orgName'] ?>" />
        </li>
        <li id="li_websiteAddress">
            <label id="label_websiteAddress" for="websiteAddress">Website Address</label>
            <input class="large" id="websiteAddress" name="websiteAddress" type="text" disabled="disabled" 
            value="<?php echo $req_org_info['websiteAddress'] ?>" size="40" maxlength="250" />
        </li>
        <li id="li_orgName">
            <label id="label_orgName">Street Address</label>
            <input id="streetAddress" name="streetAddress" type="text" disabled="disabled" value="<?php echo $req_org_info['streetAddress'] ?>" size="30" maxlength="30" /><br />
            <input id="streetAddress2" name="streetAddress2" type="text" disabled="disabled" value="<?php echo $req_org_info['streetAddress2'] ?>" size="30" maxlength="30" /><br />
            <input id="city" name="city" type="text" disabled="disabled" value="<?php echo $req_org_info['city'] ?>" size="20" maxlength="30" />
            <input id="state" name="state" type="text" disabled="disabled" value="<?php echo $req_org_info['state'] ?>" size="5" maxlength="30" />
            <input id="zipCode" name="zipCode" type="text" disabled="disabled" value="<?php echo $req_org_info['zipCode'] ?>" size="10" maxlength="30" />
        </li>
        <li id="li_category">
        	<label id="label_category">Category</label>
            <input class="element text" name="category" value="<?php
				switch($req_org_info['category']){
					case "other":
						echo "Other";
						break;
					case "farm":
						echo "Farm";
						break;
					case "farmers_market":
						echo "Farmer's Market";
						break;
					case "community_garden":
						echo "Community Garden";
						break;
					case "orchards":
						echo "Orchards";
						break;
					case "csa":
						echo "CSA";
						break;
				}?>" type="text" size="30" disabled />
        </li>
        </fieldset>
        <fieldset><legend>Contact Information</legend>
        <li id="li_email">
            <label id="label_email">Email</label>
            <input id="email" name="email" type="text" disabled="disabled" value="<?php echo $req_org_info['email'] ?>" size="30" maxlength="30" />
        </li>
        <li id="li_phoneNumber">
            <label id="label_phoneNumber">Phone Number</label>
            <input id="phoneNumber" name="phoneNumber" disabled="disabled" type="text" 
            value="(<?php echo $req_org_info['areaCode'];?>) <?php echo $req_org_info['prefix'];?>-<?php echo $req_org_info['lineNumber'];?>" size="20" maxlength="20" />
        </li>
        <li id="li_orgName">
            <label id="label_faxNumber">Fax Number</label>
            <input id="faxNumber" name="faxNumber" disabled="disabled" type="text" 
            value="(<?php echo $req_org_info['faxAreaCode'];?>) <?php echo $req_org_info['faxPrefix'];?>-<?php echo $req_org_info['faxLineNumber'];?>" size="20" maxlength="20" />
        </li>
        </fieldset>
	</form>   
    </ul>
    </div>
</div>
<?php 
	}
}
include('footer.php');
?>
